import { Button } from 'antd';
import React from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { useNavigate, Link } from 'react-router-dom';
export default function Home() {
  const navigate = useNavigate();
  const dispatch = useDispatch();
  const userList = useSelector(state => state.user);
  return (
    <div className="App">
      {JSON.stringify(userList)}
      <Button
        type="primary"
        onClick={() => dispatch({ type: 'ADD_NAME_LIST_SYNC' })}
      >
        添加
      </Button>
      <Link to={'/user'}>to user</Link>
      <Button onClick={() => navigate('/user')}>to user</Button>
    </div>
  );
}
